Skip to content

KUBE-996: approve CSR from "kubernetes.io/kubelet-serving" for Cast nodes#173

Merged
ValyaB merged 46 commits intomainfrom
KUBE-996
Mar 26, 2025
Merged

KUBE-996: approve CSR from "kubernetes.io/kubelet-serving" for Cast nodes#173
ValyaB merged 46 commits intomainfrom
KUBE-996

Conversation

@ValyaB
Copy link
Copy Markdown
Contributor

@ValyaB ValyaB commented Mar 20, 2025

No description provided.

@ValyaB ValyaB requested a review from a team as a code owner March 20, 2025 17:11
@ValyaB ValyaB changed the title KUBE-996: add informer for CSR from "kubernetes.io/kubelet-serving" KUBE-996: approve CSR from "kubernetes.io/kubelet-serving" for Cast nodes Mar 21, 2025
@Tsonov
Copy link
Copy Markdown
Contributor

Tsonov commented Mar 24, 2025

If we are approving kubelet serving certificates, we probably should match k8s recommendation - see docs that offer 3 conditions for valid serving certificates

@ValyaB
Copy link
Copy Markdown
Contributor Author

ValyaB commented Mar 26, 2025

If we are approving kubelet serving certificates, we probably should match k8s recommendation - see docs that offer 3 conditions for valid serving certificates

added validating except IP and DNS, created as a separate ticket https://castai.atlassian.net/browse/KUBE-1031

const (
approveCSRTimeout = 4 * time.Minute
)
// TODO deprecated action
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not remove the code entirely?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The EP side can send it. I want to ensure it gets approved if EP sends it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would EP send it? Even if it sends it, we will do nothing for the action itself.

if we want to have a "deprecated actions Noop" handler, then let's name it this way so it's usable in other situations.

But this is still dead code imo and can be handled by the "missing handler" path if it ever receives the action by chance.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed to ApproveCSRHandlerDeprecated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should process and acknowledge the action to maintain logical consistency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If EP sends approve csr action, we should handle and acknowledge it.
if we not acknowledged - CH will try to send it again or fail AddNode action


func (c *Certificate) validateCSR(csr *x509.CertificateRequest) error {
if c.SignerName == certv1.KubeletServingSignerName {
if len(csr.Subject.CommonName) == 0 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Common name must also match the requester (the node name), right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it is node name

}

func (c *Certificate) SignerName() string {
// node-csr prefix for bootstrap kubelet csr.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same copy-paste?

@ValyaB ValyaB merged commit 7f8e4a6 into main Mar 26, 2025
4 checks passed
@ValyaB ValyaB deleted the KUBE-996 branch March 26, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants